(function () {
	'use strict';
	
	angular.module('app').service('appService', appService);
	appService.$inject = ['$http'];
	
	function appService($http){
		var service = {
            login: login,
            getAvengers: getAvengers
        };

        return service;
		
		function login(user){
			return {"username": "nst", "userrole": "admin"};
		}
		
        function getAvengers() {
            return $http({method: 'GET', url: '/api/maa'}).
                success(function(data, status, headers, config) {
                    // this callback will be called asynchronously
                    // when the response is available
                    return data;
                }).
                error(function(data, status, headers, config) {
                    // called asynchronously if an error occurs
                    // or server returns response with an error status.
                });
        }
	}
	
})();